/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package members;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;

public class UpdateOrder {
   
    
    
    public UpdateOrder() {
    }
    
    public String execute() throws Exception {
        HttpServletRequest request=ServletActionContext.getRequest();        
        HttpSession session=request.getSession();
 
        HashSet<members.OrderItem> order= new HashSet<members.OrderItem>();
        int memberid = (Integer)session.getAttribute("MemberID");
        db.NWDB mydb=new db.NWDB();       
        ArrayList<HashMap<String,Object>> list=mydb.getbookingInfo(memberid);
        
        for(int i = 0 ; i < list.size(); i ++)
        {
            members.OrderItem oi = new members.OrderItem();
            oi.setoID(list.get(i).get("訂單序號").toString());
            oi.setOstate(list.get(i).get("單據狀態").toString());
            oi.setoName(list.get(i).get("紮營者姓名").toString());
            oi.setoTel(list.get(i).get("紮營者連絡電話").toString());
            oi.setoTotalprice(list.get(i).get("總價").toString());
            oi.setoMoneytransferDate(list.get(i).get("匯款日期").toString());
            oi.setObtansferlast5code(list.get(i).get("匯款帳號末五碼").toString());
            oi.setObankID(list.get(i).get("銀行代碼").toString());
            order.add(oi);
        }
        session.setAttribute("Order", order); 
        //session.setAttribute("iii", list.size());
        return "success";
    }
    
}
